import React, {Component} from 'react'
import {Switch, Route, NavLink} from 'react-router-dom'
import SmallA from './SmallA'
import SmallB from './SmallB'
export default class Qiantao extends React.Component {
  jump(target) {
    this.props.history.push('/qiantao/' + target);
  }
  render() {
    return (<div>
      <p>页面嵌套示例-嵌套路由放在父组件中！！！</p>
      <p>我是父组件的头部，我不会切换</p>
      <NavLink to="/qiantao/a">页面A</NavLink>
      <NavLink to="/qiantao/b">页面B</NavLink>
      <br />
      <button onClick={()=> this.jump('a')}>页面A</button>
      <button onClick={()=> this.jump('b')}>页面B</button>
      <hr />
      <Switch>
        <Route path="/qiantao/a" component={SmallA}></Route>
        <Route path="/qiantao/b" component={SmallB}></Route>
      </Switch>
    </div>)
  }
}